package pers.wensheng.patterns.behavioral_pattern.interpreter_pattern;

import pers.wensheng.patterns.behavioral_pattern.interpreter_pattern.entity.Variable;

import java.util.HashMap;
import java.util.Map;

/**
 * 环境类
 */
public class Context {
    private Map<Variable, Integer> map = new HashMap<Variable, Integer>();

    public void assign(Variable var, Integer value) {
        map.put(var, value);
    }

    public int getValue(Variable var) {
        return map.get(var);
    }
}
